var GFMainWindow = GFWindow.extend({
	constructor: function(behavior,content)
	{
		this.base(behavior,false,content);
	},
	GetExtensionFactory: function() {},
	UpdateIMName: function(name) {},
	GetPreedit: function() {},
	SetPreedit: function() {},
	ResetPreedit: function() {},
	SetPreeditText: function(str) {},
	DeletePreedit: function(c) {},
	AppendPreedit: function(c) {},
	SetPreeditInvalid: function() {}
});

var GFCandidateList = Base.extend({
	display: null,
	modifiers: null,
	className: null,
	keyset: null,
	name: null,
	occupied_by: null,

	constructor: function() {},
	SetCancelHandler: function(handler) {},
	SetList: function(header,list,selfunc) {},
	GetList: function() {},
	UpdateList: function(list) {},
	AppendList: function(list) {},
	ResetList: function() {},
	hasList: function() {},
	Show: function(show) {},
	onSelectCandidate: function(obj,choice) {},
	onNextPage: function(obj) {},
	onPrevPage: function(obj) {},
	onCancel: function(obj) {},
	UpdateContent: function() {}
});

var GFCandidateListWindow = GFWindow.extend({
	lists: null,

	constructor: function(behavior,content)
	{
		this.lists = {}
		this.base(behavior,true,content);
	},
	AddList: function(obj)
	{
		this.lists[obj.name] = obj;
	},
	SetStatus: function(str) {},
	UpdateCandidate: function() {},
	hasList: function(name)
	{
		return (this.lists[name]) ? true : false;
	},
	isOccupied: function(name)
	{
		var list;

		list = this.lists[name];
		if(list.occupied_by) return true;
		else return false;
	},
	OccupyList: function(host,name,force)
	{
		var list;

		list = this.lists[name];
		if(!list) return null;

		if(list.occupied_by) {
			if(list.occupied_by == host) return list;

			if(force) {
				// first send onCancel event
				list.onCancel(null);
				// force reset list
				list.ResetList();
				list.occupied_by = null;
			}
			else return null;
		}

		list.occupied_by = host;
		return list;
	},
	ReleaseList: function(host,name)
	{
		var list;

		list = this.lists[name];
		if(list && list.occupied_by == host) {
			list.occupied_by = null;
			// force reset list
			list.ResetList();
			return true;
		}
		else return false;
	},
	ReleaseAll: function()
	{
		var list,key;
		for(key in this.lists) {
			list = this.lists[key];
			if(list.occupied_by) {
				list.onCancel(null);
				list.ResetList();
				list.occupied_by = null;
			}
		}
	},
	keypress_handler: function(obj,key,modifiers) {},
	keydown_handler: function(obj,key,modifiers) {}
});

var GFBrowserWindow = GFWindow.extend({
	constructor: function(behavior,content)
	{
		this.base(behavior,true,content);
	},
	OpenURL: function(url) {},
	SetTitle: function(str) {}
});

var GFInternalBufferWindow = GFWindow.extend({
	target_obj: null,
	map_key: null,
	last_im: 0,
	constructor: function(behavior,content)
	{
		this.base(behavior,true,content);
		this.map_key = new Array();
	},
	SetName: function(str) {},
	SetBuffer: function(str) {},
	AppendBuffer: function(str) {},
	GetBuffer: function() {},
	DeleteBuffer: function() {},
	SaveInputMethod: function()
	{
		this.last_im = this.ime.GetCurrentInputMethodIndex();
		if(this.last_im > 0) {
			var im = this.ime.GetCurrentInputMethod();
			this.SetName('(' + im.IMName() + ')');
		}
		else this.SetName('&nbsp');
		this.ime.SelectInputMethod(0);
	},
	RestoreInputMethod: function()
	{
		if(this.shown) {
			this.ime.SelectInputMethod(this.last_im);
			this.last_im = 0;
		}
	},
	Start: function(obj) {},
	PreEnd: function() {},
	End: function() {},
	SetCompleteKeyCode: function(code,modifier) {},
	SetInstruction: function(str) {},
	SetMapKey: function(key,mod,fun)
	{
		var o;

		o = {};
		o.key = key;
		o.mod = mod;
		o.fun = fun;
		this.map_key.push(o);
	},
	ResetMapKey: function()
	{
		this.map_key = new Array();
	}
});

var GownFullAssociativeHandler = Base.extend({
	ime: null,
	constructor: function(ime)
	{
		this.ime = ime;
	},
	GenerateAssociativeWord: function(str) {},
	StopAssociativeWord: function() {}
});

var GownFullSuggestionHandler = Base.extend({
	ime: null,
	constructor: function(ime)
	{
		this.ime = ime;
	},
	GenerateSuggestion: function(str) {},
	StopSuggestion: function() {}
});

var GownFullBuilder = Base.extend({
	keydown_handler: null,
	keyup_handler: null,
	keypress_handler: null,
	onfocus_handler: null,
	lostsel_handler: null,
	SetHandler: function(keydown_handler,keyup_handler,keypress_handler,onfocus_handler,lostsel_handler)
	{
		this.keydown_handler = keydown_handler;
		this.keyup_handler = keyup_handler;
		this.keypress_handler = keypress_handler;
		this.onfocus_handler = onfocus_handler;
		this.lostsel_handler = lostsel_handler;
	},
	constructor: function() {},

	BuildCSS: function() {},
	BuildMainWindow: function(ime) {},
	BuildCandidateListWindow: function() {},
	BuildBrowserWindow: function() {},
	BuildInternalBufferWindow: function(ime) {},
	BuildMenu: function(ime) {},
	BuildAssociativeHandler: function(ime) {},
	BuildSuggestionHandler: function(ime) {},
	PostCreateGownFull: function() {}
});
